
(**
   Homework 1: Functions
 *) 

exception Unimplemented

(* 
   Write a function check : int -> bool that decides whether its
   integer argument is a strictly negative number and one less than a
   multiple of -23.

   For instance:

   check(-24) ---> true
   check(-22) ---> false
   check(37) ---> false
   check(-70) ---> true
*) 

let check : int -> bool =
  fun n -> raise Unimplemented 

(* 

Implement the factorial function following the specification

fact : int -> int

fact 0 = 1
fact n = n * fact (n - 1) when n > 0

*) 

let fact : int -> int =
  fun n -> raise Unimplemented 

(* 

Implement the Fibonacci function following the specification

fib : int -> int

fib 0 = 1
fib 1 = 1
fib n = fib (n-1) + fib (n-2) when n > 1

What is the complexity of this algorithm?

*) 

let fib : int -> int =
  fun n -> raise Unimplemented 

(* 

Implement a more efficient version of the Fibonacci function
following the specification
   
fast_fib : int -> int * int
fst (fast_fib n) = fib n
snd (fast_fib n) = fib (n-1)
   
What is the complexity of this algorithm?

*) 

let fast_fib : int -> int * int =
  fun n -> raise Unimplemented 

(* 
   
Implement the Ackermann function following the specification

ack 0 n = n + 1
ack m 0 = ack (m - 1) 1
ack m n = ack (m - 1) (ack m (n - 1)) if m > 0 and n > 0

*)

let ack : int -> int -> int =
  fun _ _ -> raise Unimplemented 

